<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="myBookBasicLabel" jhiTranslate="bookstoreApp.bookBasic.home.createOrEditLabel">Create or edit a Book Basic</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!bookBasic.id">
            <label for="id" jhiTranslate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="bookBasic.id" readonly />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.bookName" for="field_bookName">Book Name</label>
            <input type="text" class="form-control" name="bookName" id="field_bookName"
                [(ngModel)]="bookBasic.bookName" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.author" for="field_author">Author</label>
            <input type="text" class="form-control" name="author" id="field_author"
                [(ngModel)]="bookBasic.author" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.translator" for="field_translator">Translator</label>
            <input type="text" class="form-control" name="translator" id="field_translator"
                [(ngModel)]="bookBasic.translator" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.press" for="field_press">Press</label>
            <input type="text" class="form-control" name="press" id="field_press"
                [(ngModel)]="bookBasic.press" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.foreignLanguageName" for="field_foreignLanguageName">Foreign Language Name</label>
            <input type="text" class="form-control" name="foreignLanguageName" id="field_foreignLanguageName"
                [(ngModel)]="bookBasic.foreignLanguageName" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.paginalNumber" for="field_paginalNumber">Paginal Number</label>
            <input type="number" class="form-control" name="paginalNumber" id="field_paginalNumber"
                [(ngModel)]="bookBasic.paginalNumber" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.language" for="field_language">Language</label>
            <input type="text" class="form-control" name="language" id="field_language"
                [(ngModel)]="bookBasic.language" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.folio" for="field_folio">Folio</label>
            <input type="text" class="form-control" name="folio" id="field_folio"
                [(ngModel)]="bookBasic.folio" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.isbn" for="field_isbn">Isbn</label>
            <input type="text" class="form-control" name="isbn" id="field_isbn"
                [(ngModel)]="bookBasic.isbn" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.barCode" for="field_barCode">Bar Code</label>
            <input type="text" class="form-control" name="barCode" id="field_barCode"
                [(ngModel)]="bookBasic.barCode" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.bookSize" for="field_bookSize">Book Size</label>
            <input type="text" class="form-control" name="bookSize" id="field_bookSize"
                [(ngModel)]="bookBasic.bookSize" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.brand" for="field_brand">Brand</label>
            <input type="text" class="form-control" name="brand" id="field_brand"
                [(ngModel)]="bookBasic.brand" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.asin" for="field_asin">Asin</label>
            <input type="text" class="form-control" name="asin" id="field_asin"
                [(ngModel)]="bookBasic.asin" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.pubDate" for="field_pubDate">Pub Date</label>
            <div class="d-flex">
                <input id="field_pubDate" type="datetime-local" class="form-control" name="pubDate" [(ngModel)]="bookBasic.pubDate"
                />
            </div>
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.introduction" for="field_introduction">Introduction</label>
            <input type="text" class="form-control" name="introduction" id="field_introduction"
                [(ngModel)]="bookBasic.introduction" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.cover" for="field_cover">Cover</label>
            <div>
                <div *ngIf="bookBasic.cover" class="form-text text-danger clearfix">
                    <a class="pull-left" (click)="openFile(bookBasic.coverContentType, bookBasic.cover)" jhiTranslate="entity.action.open">open</a><br>
                    <span class="pull-left">{{bookBasic.coverContentType}}, {{byteSize(bookBasic.cover)}}</span>
                    <button type="button" (click)="bookBasic.cover=null;bookBasic.coverContentType=null;"
                            class="btn btn-secondary btn-xs pull-right">
                        <span class="fa fa-times"></span>
                    </button>
                </div>
                <input type="file" id="file_cover" (change)="setFileData($event, bookBasic, 'cover', false)" jhiTranslate="entity.action.addblob"/>
            </div>
            <input type="hidden" class="form-control" name="cover" id="field_cover"
                [(ngModel)]="bookBasic.cover" />
            <input type="hidden" class="form-control" name="coverContentType" id="field_coverContentType"
                [(ngModel)]="bookBasic.coverContentType" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.perface" for="field_perface">Perface</label>
            <input type="text" class="form-control" name="perface" id="field_perface"
                [(ngModel)]="bookBasic.perface" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.epilogue" for="field_epilogue">Epilogue</label>
            <input type="text" class="form-control" name="epilogue" id="field_epilogue"
                [(ngModel)]="bookBasic.epilogue" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.price" for="field_price">Price</label>
            <input type="number" class="form-control" name="price" id="field_price"
                [(ngModel)]="bookBasic.price" />
        </div>

        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.bookTypeId" for="field_bookTypeId">Book Type Id</label>
            <select class="form-control" id="field_bookTypeId" name="bookTypeId" [(ngModel)]="bookBasic.bookTypeId" >
                <option [ngValue]="null"></option>
                <option [ngValue]="bookTypeOption.id === bookBasic.bookTypeId?.id ? bookBasic.bookTypeId : bookTypeOption" *ngFor="let bookTypeOption of booktypes; trackBy: trackBookTypeById">{{bookTypeOption.id}}</option>
            </select>
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="bookstoreApp.bookBasic.authodId" for="field_authodId">Authod Id</label>
            <select class="form-control" id="field_authodId" name="authodId" [(ngModel)]="bookBasic.authodId" >
                <option [ngValue]="null"></option>
                <option [ngValue]="authorOption.id === bookBasic.authodId?.id ? bookBasic.authodId : authorOption" *ngFor="let authorOption of authors; trackBy: trackAuthorById">{{authorOption.id}}</option>
            </select>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
            <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
        </button>
    </div>
</form>
